package easy;

import java.util.LinkedList;
import java.util.Queue;

public class Solution_933 {

    private Queue<Integer> queue = new LinkedList<>();

    public void RecentCounter() {
    }

    public int ping(int t) {
        int v = t - 3000;
        while (!queue.isEmpty()) {
            Integer peek = queue.peek();
            if (peek < v) {
                queue.poll();
            } else {
                break;
            }
        }
        queue.add(t);
        return queue.size();
    }

    public static void main(String[] args) {
        Solution_933 model = new Solution_933();
        System.out.println(model.ping(1));
        System.out.println(model.ping(100));
        System.out.println(model.ping(3001));
        System.out.println(model.ping(3002));
    }
}
